<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>批次信息管理</title>
<meta name="decorator" content="default"/>
<script src="${ctxStatic}/common/change/change.js"></script>
<script type="text/javascript">
	$(function() {
		$("#btnReset").click(function(){
			$("#vaccineId").val("").select2();
			$("#companyCode").val("").select2();
			$("#batchno").val("");
			$("#doseType").val("").select2();
			$("#beginVaccExpDate").val("");
			$("#endVaccExpDate").val("");
			$("#beginDate").val("");
			$("#endDate").val("");
		});
		
		initVaccName(bsVaccineBatchno.companyCode,bsVaccineBatchno.vaccineId);
		initVaccCompanyName(bsVaccineBatchno.companyCode);
		$(".vaccineCompany").change(function(){
			var vaccId = $(this).val();
			initCompanyName($(this).val());
			if(vaccId == ""){
				initVaccCompanyName("");
			}
		});
		
	});
	
	var bsVaccineBatchno = JSON.parse('${fns:toJson(bsVaccineBatchno)}');
	
	
    function down(){
		top.$.jBox.confirm("确认要导出疫苗批次数据吗？","系统提示",function(v,h,f){
			if(v=="ok"){
				$("#searchForm").attr("action","${ctx}/vaccinate/bsVaccineBatchno/export");
				$("#searchForm").submit();
			}
			$("#searchForm").attr("action","${ctx}/vaccinate/bsVaccineBatchno/manageBatchno");
		},{buttonsFocus:1});
		top.$('.jbox-body .jbox-icon').css('top','55px');
	}
    function btnPdf(id){
    	debugger;
 		var url = "${ctx}/vaccinate/bsVaccineBatchno/pdfForm?id="+ id;
 		layer.open({
			type : 2,
			title : '上传文件详情',
			shadeClose : true,
			shade : 0.8,
			maxmin: true,
			area : [screen.availWidth * 0.6 + 'px', screen.availHeight * 0.5 + 'px' ],
			content : url
		});
    }
	
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
</script>
<style type="text/css">
	.minWidth {
		min-width: 177px;
	}	
	#contentTable td ,#contentTable th{
		text-align: center;
		padding:1px 2px;
	}
	#contentTable tbody tr td{
		font-size: 13px;
	}
</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<%-- <li class="active"><a href="${ctx}/vaccinate/bsVaccineBatchno/manageBatchno?batchType=1">疫苗批次信息管理</a></li> --%>
		<li class="active"><a href="#">疫苗批次信息管理</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="bsVaccineBatchno" action="${ctx}/vaccinate/bsVaccineBatchno/manageBatchno" method="post" class="breadcrumb form-search">
		<input id="batchType" name="batchType" type="hidden" value="${bsVaccineBatchno.batchType}"/>
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<table class="table table-bordered">
			<tr>
				<td><span>疫苗名称</span></td>
				<td>
					<form:select path="vaccineId" class="span2 minWidth vaccineCompany">
						<form:option value="" label="--请选择--"/>
					</form:select>         
				</td>
				<td><span>生产企业</span></td>
				<td>
					<form:select path="companyCode" class="span2 minWidth changeCompany vaccCompanyName">
						<form:option value="" label="--请选择--"/>
					</form:select>
				</td> 
			    <td><span>批号</span></td>
				<td><form:input path="batchno" class="input-medium"></form:input></td>
			</tr>
			
			<tr>
				<td><span>剂型</span></td>
				<td >
					<form:select path="doseType" id="doseType" class="span2 minWidth">
						<form:option value="" label="--请选择--"/>
						<form:options items="${fns:getDictList('bs_vaccineInfo_doseType')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</td>
				<td><span>有效起始日期</span></td>
				<td>
					<input name="beginVaccExpDate" id="beginVaccExpDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${bsVaccineBatchno.beginVaccExpDate}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
				</td>
				<td><span>有效截止日期</span></td>
				<td>
					<input name="endVaccExpDate" id="endVaccExpDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${bsVaccineBatchno.endVaccExpDate}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
				</td>
			</tr>
			<tr>
				<td><span>有效期情况</span></td>
			    <td width="400px;">
				    <form:radiobuttons path="dateType" items="${fns:getDictList('dateType')}" itemLabel="label" itemValue="value"/>
				</td>
				<td><span>起始修改日期</span></td>
				<td>
					<input name="beginDate" id="beginDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${bsVaccineBatchno.beginDate}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
				</td>
				<td><span>截止修改日期</span></td>
				<td>
					<input name="endDate" id="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${bsVaccineBatchno.endDate}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
				</td>
			</tr>
		</table> 
		<div>
			<button id="btnSubmit" class="btn btn-primary" type="submit" >查询</button>
			<button id="btnReset" class="btn btn-primary" type="button" >重置</button>
			<button id="btnDown" class="btn btn-primary" type="button" onclick="down()">导出</button>
			<%-- <a href="${ctx}/vaccinate/bsVaccineInfo/form?batchType=${bsVaccineBatchno.batchType}" class="btn btn-primary">添加</a> --%>
			<!-- <button id="btnAdd" class="btn btn-primary" type="button">添加</button> -->
			<a href="${ctx}/vaccinate/bsVaccineBatchno/addForm?batchType=${bsVaccineBatchno.batchType}" class="btn btn-primary">添加</a>
		</div>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th width="60px">操作</th>
				<th>疫苗名称</th>
				<th>通用名</th>
				<!-- <th>业务名称</th> -->
				<th>生产企业</th>
				<th>疫苗批号</th>
				<!-- <th>亚批号</th> -->
				<th>有效日期</th>
				<th>规格<br>(剂/支或粒)</th>
				<th>容器类型</th>
				<th>剂量</th>
				<th>剂型</th>
				<th>批准文号</th>
				<th>批签发合格<br>证明编号</th>
				<!-- <th>批签发文件</th> -->
				<th>录入单位</th>
				<th>修改时间</th>
				<th>批签发文件</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="bsVaccineBatchno"  begin="0"  varStatus="status">
				<tr data-id="${bsVaccineBatchno.id}">
					<td>
						<a id="btnEdit" href="${ctx}/vaccinate/bsVaccineBatchno/editForm?id=${bsVaccineBatchno.id}">修改</a>
					</td>
					<td>${bsVaccineBatchno.vaccineName}</td>
					<td>  ${bsVaccineBatchno.vaccNameAll} </td>
					<%-- <td>${bsVaccineBatchno.businessName}</td> --%>
					<td>${bsVaccineBatchno.companyName}</td>
					<td>
						${bsVaccineBatchno.batchno}
						<c:if test="${not empty bsVaccineBatchno.secondBatchno}">
				        <span title="(查询批号时不需要带入亚批号)" style="color: #2fa4e7;">-${bsVaccineBatchno.secondBatchno}</span>
				    </c:if>
					</td>
					<td><fmt:formatDate value="${bsVaccineBatchno.outBoundDate}" pattern="yyyy/MM/dd"/></td>
					<td>${bsVaccineBatchno.spec}</td>
					<td>${bsVaccineBatchno.containerType}</td>
					<td>${bsVaccineBatchno.dose}</td>
					<td>${bsVaccineBatchno.doseType}</td>
					<td>${bsVaccineBatchno.customBillNo }</td>
					<td>${bsVaccineBatchno.certifiCode }</td>
					<%-- <td>
					    <c:if test="${not empty bsVaccineBatchno.pdfId}"> 
						    <c:set value="${bsVaccineBatchno.bsVaccineBatchnoPdf}" var="var"/>
						    <c:forEach items="${var}" var="pdf"  begin="0">
							    <a href="${ctx}/vaccinate/bsVaccineBatchno/downPdf?id=${pdf.id}">${pdf.fileName}</a><br>
						    </c:forEach>
						</c:if>
					</td> --%>
					<td>${bsVaccineBatchno.createOrgName }</td>
					<td><fmt:formatDate value="${bsVaccineBatchno.updateDate }" pattern="yyyy/MM/dd"/> </td>
					<td>
						<a href="javascript:;" onclick="btnPdf('${bsVaccineBatchno.id}')">上传的批签发文件</a>
					</td>
				</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>